home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / MYLINE.H < prev    next >
C/C++ Source or Header  |  1993-06-14  |  2KB  |  57 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 06-13-93 (12:22)             Number: 140
  4. From: DAVID NUGENT                 Refer#: NONE
  5.   To: ALL                           Recvd: NO  
  6. Subj: [09 of 12] myLine.h            Conf: (37) C++ Langua
  7. ---------------------------------------------------------------------------
  8. // myLine.h
  9. //
  10. // Donated to the public domain; no restrictions on reuse or abuse apply.
  11. // by David Nugent, 7th June, 1993.
  12. // Simple line input class for istream to demonstrate input of a complete
  13. // line rather than whitespace separated tokens (the default for operator<<
  14. // for char* and other built-in types).
  15. // Works by overloading operator>> for a customised class - this functionality
  16. // is easily incorporated into your favourite String class
  17. //
  18.  
  19. # if !defined(_myLine_h)
  20. # define _myLine_h 1
  21.  
  22. # define AUTO_GROW 1            // Allow autogrowth of buffer to fit
  23. # define ALLOC_LEN 80           // Standard length & growth increment
  24.  
  25.     // Class declaration
  26.  
  27. class myLine
  28. {
  29.  
  30.   public:
  31.  
  32.     myLine (short buflen =ALLOC_LEN);
  33.     myLine (char * usebuf, short buflen =ALLOC_LEN);
  34.     ~myLine (void);
  35.                                        // Get buffer address
  36.     char const * buf (void) const { return mybuf; }
  37.                                        // Conversion operators
  38.     char const * operator() (void) const { return mybuf; } // Explicit cast
  39.     operator char const * (void) const { return mybuf; }   // Implicit cast
  40.                                        // istream operator>>
  41.     friend istream & operator>> (istream &, myLine &);
  42.  
  43.   private:
  44.  
  45.     short len, xalloc;
  46.     char * mybuf;
  47.  
  48. };
  49.  
  50. # endif     // _myLine_h
  51.  
  52. --- MaltEd 1.0.b5
  53.  * Origin: Unique Computing Pty Ltd (3:632/348)
  54. SEEN-BY: 1/211 11/2 4 13/13 101/1 109/25 114/5 123/19 124/1 153/752 154/40
  55. SEEN-BY: 154/77 157/110 159/100 125 140 180 270 430 575 950 203/23 209/209
  56. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2430/1 2440/5 3603/20
  57.